<template>
  <div class="header">
    <!-- 左边箭头  返回部分 -->
    <div class="header-lf" @click="$router.go(-1)" v-show="showLeft">
      <i class="fa fa-chevron-left"></i>
      <span>返回</span>
    </div>
    <!-- 中间标题 -->
    <div class="header-center">{{ title }}</div>
    <div class="header-right"></div>
  </div>
</template>

<script>
export default {
  name: 'MyHeader',
  props: {
    title: String,
    showLeft: {
      type: Boolean,
      default: false
    }
  }
}
</script>

<style lang="less" scoped>
.header {
  position: sticky;
  top: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  background-color: #009eef;
  font-size: 16px;
  padding: 0 10px;
  height: 49px;
  color: #fff;
  .header-lf {
    display: flex;
    align-items: center;
    height: 100%;
    i {
      margin-right: 5px;
    }
  }
  .header-center {
    height: 100%;
    flex: 1;
    line-height: 49px;
    text-align: center;
  }
}
</style>
